package com.lhm.service;


import com.lhm.entity.MyUser;

import com.lhm.entity.User;
import com.lhm.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;


@Primary
@Service
public class UserDetailsImpl implements UserDetailsService {

    @Autowired
    UserMapper userMapper;

    @Override
    public UserDetails loadUserByUsername(String account) throws UsernameNotFoundException {
        //访问Dao
        MyUser myUser=userMapper.findByAccount(account);
        System.out.println(myUser);
        return myUser;
    }
}
